package com.niiwoo.civet.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 费用类型mapping还款顺序
 */
@Getter
@AllArgsConstructor
public enum FeeTypeRefundSequenceEnum {

    FIRST(FeeTypeEnum.GUARANTEE_FEE, 1),
    SECOND(FeeTypeEnum.MANAGEMENT_FEE, 2),
    THIRD(FeeTypeEnum.CAPITAL,3),
    FOURTH(FeeTypeEnum.INTEREST, 4),
    FIFTH(FeeTypeEnum.PENALTY, 5);

    private final FeeTypeEnum feeTypeEnum;

    private final int sequence;

    public static FeeTypeRefundSequenceEnum enumOf(FeeTypeEnum feeTypeEnum){
        for (FeeTypeRefundSequenceEnum feeTypeRefundSequenceEnum : FeeTypeRefundSequenceEnum.values()) {
            if(feeTypeRefundSequenceEnum.getFeeTypeEnum().equals(feeTypeEnum)){
                return feeTypeRefundSequenceEnum;
            }
        }
        throw new RuntimeException("枚举无法转换");
    }
}
